package com.xbts.system.domain;

import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import com.xbts.common.annotation.Excel;
import com.xbts.common.utils.StringUtils;
import com.xbts.common.core.domain.BaseEntity;

/**
 * 政务云对象 cn_government_cloud
 *
 * @author xbts
 * @date 2023-08-23
 */
@Data
@ApiModel("政务云对象")
@TableName("cn_government_cloud")
public class CnGovernmentCloud extends BaseEntity {

private static final long serialVersionUID=1L;

    /** 政务云主键 */
    @TableId
    private String govId;

    /** 服务器名称 */
    @Excel(name = "服务器名称")
    @ApiModelProperty("服务器名称")
    private String serverName;

    /** 服务器类型 */
    @Excel(name = "服务器类型")
    @ApiModelProperty("服务器类型")
    private String serverType;

    /** 政务云服务器类型主键 */
    @Excel(name = "政务云服务器类型主键")
    @ApiModelProperty("政务云服务器类型主键")
    private String serverTypeId;

    /** CPU */
    @Excel(name = "CPU")
    @ApiModelProperty("CPU")
    private String cpu;

    /** 内存 */
    @Excel(name = "内存")
    @ApiModelProperty("内存")
    private String memory;

    /** 硬盘大小 */
    @Excel(name = "硬盘大小")
    @ApiModelProperty("硬盘大小")
    private String hardDisk;

    /** 防御 */
    @Excel(name = "防御")
    @ApiModelProperty("防御")
    private String defense;

    /** 带宽 */
    @Excel(name = "带宽")
    @ApiModelProperty("带宽")
    private String bandwidth;

    /** IP */
    @Excel(name = "IP")
    @ApiModelProperty("IP")
    private String ip;

    /** 其它 */
    @Excel(name = "其它")
    @ApiModelProperty("其它")
    private String other;

    /** 计费模式（0按次 30按月 365按年） */
    @Excel(name = "计费模式（0按次 30按月 365按年）")
    @ApiModelProperty("计费模式（0按次 30按月 365按年）")
    private Integer billingMode;

    /** 价格 */
    @Excel(name = "价格")
    @ApiModelProperty("价格")
    private BigDecimal price;

    @ApiModelProperty("地区ID")
    private String areaId;

    /**
     * 是否删除（0未删除 1已删除）
     */
    private Boolean deleteFlag;

    /**
     * 是否置顶
     */
    private Boolean topped;

    public<T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotEmpty(serverTypeId),"server_type_id",serverTypeId);
        queryWrapper.like(StringUtils.isNotEmpty(serverName),"server_name",serverName);
        queryWrapper.like(StringUtils.isNotEmpty(cpu),"cpu",cpu);
        queryWrapper.like(StringUtils.isNotEmpty(memory),"memory",memory);
        queryWrapper.like(StringUtils.isNotEmpty(hardDisk),"hard_disk",hardDisk);
        queryWrapper.like(StringUtils.isNotEmpty(defense),"defense",defense);
        queryWrapper.like(StringUtils.isNotEmpty(ip),"ip",ip);
        queryWrapper.like(StringUtils.isNotEmpty(other),"other",other);
        queryWrapper.eq("delete_flag", "0");
        queryWrapper.eq(StringUtils.isNotEmpty(areaId),"area_id", areaId);
        queryWrapper.orderByDesc("topped");
        queryWrapper.orderByDesc("create_time");
        return queryWrapper;
    }
}
